export function getMaxAndUserConfig(rows) {
  var res = {
    maxShow: {imageSrc: null,title: null,time: null},
    usershow: {
      cover: {
        bjsrc: "",
        usersrc: "",
        username: ""
      },
      detail: {
        traffic: null,
        blogCount: null,
        detail: null,
        images: null,
      }
    },
  }
  for(let i = 0; i < rows.length; i++){
    if(rows[i].configKey == "maxImageSrc"){
      res.maxShow.imageSrc = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "maxTitle"){
      res.maxShow.title = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "maxTime"){
      res.maxShow.time = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "userBjsrc"){
      res.usershow.cover.bjsrc = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "userUsersrc"){
      res.usershow.cover.usersrc = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "userUsername"){
      res.usershow.cover.username = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "traffic"){
      res.usershow.detail.traffic = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "blogCounts"){
      res.usershow.detail.blogCount = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "userDetail"){
      res.usershow.detail.detail = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "images"){
      res.usershow.detail.images = rows[i].configValue;
      continue;
    }
  }

  return res;
}

export function getUserConfig(rows){
  var usershow =  {
      cover: {
        bjsrc: "",
        usersrc: "",
        username: ""
      },
      detail: {
        traffic: null,
        blogCount: null,
        detail: null,
        images: null,
      }
  }
  for(let i = 0; i < rows.length; i++){
    if(rows[i].configKey == "userBjsrc"){
      usershow.cover.bjsrc = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "userUsersrc"){
      usershow.cover.usersrc = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "userUsername"){
      usershow.cover.username = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "traffic"){
      usershow.detail.traffic = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "blogCounts"){
      usershow.detail.blogCount = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "userDetail"){
      usershow.detail.detail = rows[i].configValue;
      continue;
    }
    if(rows[i].configKey == "images"){
      usershow.detail.images = rows[i].configValue;
      continue;
    }
  }

  return usershow;
}
